# 功能函数文件
# ip转换
def ipTrans(hexStr):
    strList = hexStr.split(':')
    return '{}.{}.{}.{}'.format(int('0x' + strList[0], 16), int('0x' + strList[1], 16), int('0x' + strList[2], 16),
                                int('0x' + strList[3], 16))


# 计算错误率
def calcuRate(args):
    if args[1] + args[2] > 0:
        return round(args[0] / (args[1] + args[2]), 2)
    else:
        return 0.00


def timeTrans(string):
    string = string.split('.')[0].split(':')
    res = ''
    if string[0] != '0':
        res += string[0] + '天'
    if string[1] != '0':
        res += string[1] + '时'
    if string[2] != '0':
        res += string[2] + '分'
    # else: res += '0分'
    if string[2] != '0':
        res += string[3] + '秒'
    return res
